<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15="">

                    <div class="layui-form" wid100="" lay-filter="">

                        <input type="hidden" name="id" value="{$id}">
                        <div class="layui-form-item">
                            <label class="layui-form-label">修改基础热度: </label>
                            <div class="layui-input-block">
                                <input type="text" name="heat" value="{$data}" class="layui-input" lay-verify="required|number">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block text-center">
                                <button class="layui-btn" lay-submit="" lay-filter="livecategory-add">确认保存</button>
                                <button class="layui-btn layui-btn-primary" id="close">取消</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.min.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'admin', 'live'], function () {
        var $ = layui.$
            , form = layui.form
            , admin = layui.admin;
        var index = parent.layer.getFrameIndex(window.name);

        $('#close').on("click", function () {
            parent.layer.close(index);
        });

        form.on('submit(livecategory-add)', function (obj) {
            var curr_heat = "{$data |default = 0}";
            var inuput_heat = obj.field.heat;
            layer.confirm('是否确定把直播间的热度修改为 ' + inuput_heat + '？',
                {
                    area:['440px','160px'], //弹框的大小
                }, function (index) {
                //提交
                admin.req({
                    url: '/admin/live/heat_edit_post'
                    , data: obj.field
                    , success: function (res) {
                        if (res.code == 0) {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                            parent.layer.msg(res.msg, {icon: 1});
                            //bug fix: 操作人员设置完热度数值点击确定配置窗口没有消失的bug
                            parent.layui.table.reload('LAY-live-manage');
                        }
                    }
                });
            });

            return false;
        });
    });
</script>
</body>
</html>
